<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
*{
	padding:0px;
	margin:0px;
	}

body{
	font-family:Arial, Helvetica, sans-serif;
	background:url(images-login/grass.jpg);
	font-size:13px;
    
	}
img{
	border:0;
	}
.lg{width:468px; height:468px; margin:100px auto; background:url(images-login/login_bg.png) no-repeat;}
.lg_top{ height:200px; width:468px;}
.lg_main{width:400px; height:180px; margin:0 25px;}
.lg_m_1{
	width:290px;
	height:100px;
	padding:60px 55px 20px 55px;
}
.ur{
	height:37px;
	border:0;
	color:#666;
	width:236px;
	margin:4px 28px;
	background:url(images-login/user.png) no-repeat;
	padding-left:10px;
	font-size:12pt;
	font-family:Arial, Helvetica, sans-serif;
}
.pw{
	height:37px;
	border:0;
	color:#666;
	width:236px;
	margin:4px 28px;
	background:url(images-login/password.png) no-repeat;
	padding-left:10px;
	font-size:12pt;
	font-family:Arial, Helvetica, sans-serif;
}
.code{
	height:27px;
	border:0;
	color:#666;
	width:140px;
	margin:4px 10px 4px 28px;
	padding-left:10px;
	font-size:12pt;
	font-family:Arial, Helvetica, sans-serif;
}
.bn{width:330px; height:72px; background:url(images-login/enter.png) no-repeat; border:0; display:block; font-size:18px; color:#FFF; font-family:Arial, Helvetica, sans-serif; font-weight:bolder;}
.lg_foot{
	height:80px;
	width:330px;
	padding: 6px 68px 0 68px;
}
</style>
<script>
function txcheck(){	
	if(formvalidator("all"))
	{
		document.getElementById('form1').submit();
	}
}
function loginreset(){	
	document.getElementById('form1').reset();
}
function formvalidator(obj)
{
	
	var controlId = "all";
	 if (typeof(obj) != "string" )
	 {
		 controlId = obj.id;
	 }
	if(controlId=="all" || controlId=="model.loginName")
	{
		if(document.getElementById("model.loginName").value=="")
		{
			document.getElementById('model.loginName').style.borderColor = '#ff9073';
			document.getElementById('model.loginName').style.backgroundColor = '#ff9073';
			return false;
		}
		else
		{
			document.getElementById('model.loginName').style.borderColor = '';
			document.getElementById('model.loginName').style.backgroundColor = '';
		}
	}
	if(controlId=="all" || controlId=="model.password")
	{
		if(document.getElementById("model.password").value=="")
		{
			console.log(document.getElementById('model.password').style);
			document.getElementById('model.password').style.borderColor = '#ff9073';
			document.getElementById('model.password').style.backgroundColor = '#ff9073';
			return false;
		}
		else
		{
			document.getElementById('model.password').style.borderColor = '';
			document.getElementById('model.password').style.backgroundColor = '';
		}
	}
	if(controlId=="all" || controlId=="code")
	{
		if(document.getElementById("code").value=="")
		{
			document.getElementById('code').style.borderColor = '#ff9073';
			document.getElementById('code').style.backgroundColor = '#ff9073';
			return false;
		}
		else
		{
			document.getElementById('code').style.borderColor = '';
			document.getElementById('code').style.backgroundColor = '';
		}
	}
	
	return true;
}
document.onkeydown = function(e)
{
    var k = e||event; //兼容Firefox
	if( k.keyCode == 13 )
	{
		txcheck();
	}
};
window.onload = function(){
	if (window.top!=window.self)  
	{
		window.top.location="login_ad.do";
	}
};
</script>
</head>

<body class="b">
<div class="lg">
<form id='form1' name='form1' onsubmit='return txcheck();' action="login_main.do" method="post">
    <div class="lg_top"></div>
    <div class="lg_main">
        <div class="lg_m_1">
        
        <input name="model.loginName" id="model.loginName" placeholder="请输入您的用户名" onblur="formvalidator(this)" class="ur" />
        <input name="model.password" id="model.password" type="password" placeholder="请输入您的密码" onblur="formvalidator(this)" class="pw" />
        <input style="border:solid 1px #eeeeee;" id="code" placeholder="请输入验证码" class="code" name="code" onblur="formvalidator(this)"/>&nbsp;&nbsp;
		<img alt="看不清楚？换一张" title="看不清楚？换一张" src="./codepicservlet" style="cursor: pointer;" onclick= "this.src='./codepicservlet?s='+Math.random()"/>
        </div>
    </div>
    <div class="lg_foot">
    <input type="button" value="Login In" onclick="txcheck();" class="bn" /></div>
</form>
</div>
</body>
</html>
